package com.atguigu.spzx.product.controller;

import com.atguigu.spzx.model.entity.system.Category;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.product.service.CategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/product/category")
@Tag(name = "分类接口管理")
public class categoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/findCategoryTree")
    @Operation(summary = "获取分类树形数据")
    public Result<List<Category>> findCategory(){
        List<Category> category = categoryService.findCategoryTree();
        return Result.OK(category);
    }
}
